home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
039a
/
dflat8.zip
/
STATBAR.C
< prev
next >
Wrap
Text File
|
1991-09-30
|
1KB
|
58 lines
/* ---------------- statbar.c -------------- */
#include "dflat.h"
int StatusBarProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
{
char *statusbar;
switch (msg) {
case CREATE_WINDOW:
case MOVE:
SendMessage(wnd, CAPTURE_CLOCK, 0, 0);
break;
case KEYBOARD:
if ((int)p1 == CTRL_F4)
return TRUE;
break;
case PAINT:
if (!isVisible(wnd))
break;
if ((statusbar = calloc(1, WindowWidth(wnd)+1)) == NULL)
break;
memset(statusbar, ' ', WindowWidth(wnd));
*(statusbar+WindowWidth(wnd)) = '\0';
strncpy(statusbar+1, "F1=Help", 7);
if (wnd->text) {
int len = min(strlen(wnd->text), WindowWidth(wnd)-17);
if (len > 0) {
int off=(WindowWidth(wnd)-len)/2;
strncpy(statusbar+off, wnd->text, len);
}
}
if (wnd->TimePosted)
*(statusbar+WindowWidth(wnd)-8) = '\0';
SetStandardColor(wnd);
wputs(wnd, statusbar, 0, 0);
free(statusbar);
return TRUE;
case BORDER:
return TRUE;
case CLOCKTICK:
SetStandardColor(wnd);
wputs(wnd, (char *)p1, WindowWidth(wnd)-8, 0);
wnd->TimePosted = TRUE;
return TRUE;
case CLOSE_WINDOW:
SendMessage(NULL, RELEASE_CLOCK, 0, 0);
if (GetText(wnd) != NULL) {
free(GetText(wnd));
GetText(wnd) = NULL;
}
break;
default:
break;
}
return BaseWndProc(STATUSBAR, wnd, msg, p1, p2);
}